package neusoft.edu.cn.guanshangshiguang.activities;

import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.widget.TextView;

import neusoft.edu.cn.guanshangshiguang.BatteryReceiver;
import neusoft.edu.cn.guanshangshiguang.R;

public class ReadingActivity extends AppCompatActivity {

    private TextView name,pow;
    private AlwaysMarqueeTextView content;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActionBar actionBar = getSupportActionBar();//去掉标题栏
        actionBar.hide();//去掉标题栏
        setContentView(R.layout.activity_reading);

        content = (AlwaysMarqueeTextView)findViewById(R.id.reading_content);
        name = findViewById(R.id.reading_name);
        pow = findViewById(R.id.pow);
        content.setMovementMethod(ScrollingMovementMethod.getInstance());

        IntentFilter filter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
        BatteryReceiver receiver = new BatteryReceiver(pow);
        registerReceiver(receiver, filter);

        content.setText(getIntent().getStringExtra("content"));
        name.setText(getIntent().getStringExtra("bname"));
    }
}
